W razie problemów technicznych ze Szkopułem, prosimy o kontakt mailowy pod adresem [email protected].
Jeśli chciałbyś porozmawiać o zadaniach, rozwiązaniach lub problemach technicznych, zapraszamy na serwery Discord. Są one moderowane przez społeczność, ale członkowie zespołu technicznego też są tam aktywni.
On an extremely large chess board many chessmen were located1 - all of them of the same colour. We say that a given chessman can capture specified position on the chess board, if the chessman can move to that position, particularly:
Write a program which:
In the first line of the input there are two integers and (, ), separated with a single space and representing the number of chessmen located on the square chessboard and its dimension . Each of the following lines is of the format " ", where is a letter representing:
The output should consist of lines. 'th line should contain one integer, representing the number of positions being captured by 'th chessman from the input.
For the input data:
6 5 K 5 5 G 4 1 W 1 3 K 2 3 H 2 2 S 3 3
the correct result is:
3 2 4 5 7 7
The image above represents the chessboard from the sample input.
Lines of different style represent positions being captured by chessmen.
The possible destinations of the knight are represented by big dots.
Task author: Jakub Radoszewski.